Skip to content

ITP-2025-LONDON|LOVETH-OKAFOR|Module-Data-Flows|Book-library - #177

Closed
loveth900 wants to merge 2 commits into
CodeYourFuture:mainfrom
loveth900:Book-library
Closed

loveth900 wants to merge 2 commits into
CodeYourFuture:mainfrom
loveth900:Book-library

Conversation

@loveth900

@loveth900 loveth900 commented Apr 2, 2025 •

Copy link
Copy Markdown

Learners, PR Template

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with COHORT_NAME | FIRST_NAME LAST_NAME | REPO_NAME | WEEK
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

Briefly explain your PR.

Questions

Ask any questions you have for your reviewer.

@loveth900 loveth900 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Apr 2, 2025

@cjyuan cjyuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • There are a few improvements you can make.

  • When I checked the code in index.html at https://validator.w3.org/, it indicated some errors.

Comment thread debugging/book-library/script.js Outdated
Comment on lines +97 to +99
if (title.value === "" || pages.value === "") {
alert("Please fill in all fields!");
return false;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In terms of input validation,

  1. Are all input properly checked?
  2. What if a user enters only space characters in the "title" input field?
  3. What if a users enters -1 or 3.1416 in the "pages" input field?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you very much for your obsarvation, i have implemented the needed function

Comment thread debugging/book-library/script.js Outdated
Comment on lines 36 to 38
for (let n = rowsNumber - 1; n > 0; n--) {
table.deleteRow(n);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of deleting the table rows one by one, can you think of a more efficient way to remove all rows (except the <th>...</th>) in the table?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i have fix the error

Comment thread debugging/book-library/script.js Outdated
Comment on lines +49 to +50
titleCell.innerHTML = book.title;
authorCell.innerHTML = book.author;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the way the book's title is assigned to an HTML element, a book with a title containing special character sequence such as <i> can possibly ruin the display.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you think of a more consistent way to name the variables representing the two buttons, changeBut and delButton?

Comment thread debugging/book-library/script.js Outdated
Comment on lines +75 to +78
alert(`You've deleted title: ${book.title}`);
myLibrary.splice(i, 1);
render();
saveToLocalStorage(); // Save updated library to localStorage
render(); // Re-render the table

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment when the alert message is displayed, has the book mentioned in the message been deleted yet?
How would you rearrange these statements to make the message truthful?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cjyuan i really appreciate your time and effort, and most espacially the details you pay for everthing!! thanks again for the time.

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Apr 8, 2025
@loveth900 loveth900 added the Complete Volunteer to add when work is complete and all review comments have been addressed. label Apr 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed. Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants